home *** CD-ROM | disk | FTP | other *** search
/ Freelog 115 / FreelogNo115-MaiJuin2013.iso / Internet / Filezilla Server / FileZilla_Server-0_9_41.exe / source / interface / EnterSomething.cpp < prev    next >
C/C++ Source or Header  |  2011-11-06  |  3KB  |  100 lines

  1. // FileZilla Server - a Windows ftp server
  2.  
  3. // Copyright (C) 2002-2004 - Tim Kosse <tim.kosse@gmx.de>
  4.  
  5. // This program is free software; you can redistribute it and/or
  6. // modify it under the terms of the GNU General Public License
  7. // as published by the Free Software Foundation; either version 2
  8. // of the License, or (at your option) any later version.
  9.  
  10. // This program is distributed in the hope that it will be useful,
  11. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. // GNU General Public License for more details.
  14.  
  15. // You should have received a copy of the GNU General Public License
  16. // along with this program; if not, write to the Free Software
  17. // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  18.  
  19. // EnterSomething.cpp: Implementierungsdatei
  20. //
  21.  
  22. #include "stdafx.h"
  23. #include "filezilla server.h"
  24. #include "EnterSomething.h"
  25.  
  26. #if defined(_DEBUG) && !defined(MMGR)
  27. #define new DEBUG_NEW
  28. #undef THIS_FILE
  29. static char THIS_FILE[] = __FILE__;
  30. #endif
  31.  
  32. /////////////////////////////////////////////////////////////////////////////
  33. // Dialogfeld CEnterSomething 
  34.  
  35. CEnterSomething::CEnterSomething(UINT nID, int dialogID /*=CEnterSomething::IDD*/):CDialog(dialogID, 0)
  36. {
  37.     //{{AFX_DATA_INIT(CEnterSomething)
  38.     m_String = _T("");
  39.     //}}AFX_DATA_INIT
  40.     m_nID = nID;
  41.     allowEmpty = false;
  42. }
  43.  
  44. void CEnterSomething::DoDataExchange(CDataExchange* pDX)
  45. {
  46.     CDialog::DoDataExchange(pDX);
  47.     //{{AFX_DATA_MAP(CEnterSomething)
  48.     DDX_Control(pDX, IDC_TEXT, m_cText);
  49.     DDX_Control(pDX, IDOK, m_OkCtrl);
  50.     DDX_Text(pDX, IDC_EDIT1, m_String);
  51.     //}}AFX_DATA_MAP
  52. }
  53.  
  54.  
  55. BEGIN_MESSAGE_MAP(CEnterSomething, CDialog)
  56.     //{{AFX_MSG_MAP(CEnterSomething)
  57.     ON_EN_CHANGE(IDC_EDIT1, OnChangeEdit1)
  58.     //}}AFX_MSG_MAP
  59. END_MESSAGE_MAP()
  60.  
  61. /////////////////////////////////////////////////////////////////////////////
  62. // Behandlungsroutinen fⁿr Nachrichten CEnterSomething 
  63.  
  64. void CEnterSomething::OnOK() 
  65. {
  66.     UpdateData(TRUE);
  67.     //Check if a value was entered
  68.     if (m_String == _T("") && !allowEmpty)
  69.         AfxMessageBox(IDS_ERRORMSG_ENTERSTRING, MB_ICONEXCLAMATION);
  70.     else
  71.         CDialog::OnOK();
  72. }
  73.  
  74. void CEnterSomething::OnChangeEdit1() 
  75. {
  76.     //Disable the OK button if the edit field is empty
  77.     UpdateData(TRUE);
  78.     if (allowEmpty)
  79.         m_OkCtrl.EnableWindow(TRUE);
  80.     else
  81.         m_OkCtrl.EnableWindow((m_String != _T("")) ? TRUE : FALSE);
  82. }
  83.  
  84. BOOL CEnterSomething::OnInitDialog() 
  85. {
  86.     CDialog::OnInitDialog();
  87.     
  88.     //Load and set the window title
  89.     CString title;
  90.     title.LoadString(m_nID);
  91.     int pos=title.Find(_T("|"));
  92.     SetWindowText(title.Left(pos));
  93.     m_cText.SetWindowText(title.Mid(pos+1));
  94.     //Disable the OK button if the edit field is empty
  95.     m_OkCtrl.EnableWindow(m_String!=""?TRUE:FALSE);
  96.  
  97.     return TRUE;  // return TRUE unless you set the focus to a control
  98.                   // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurⁿckgeben
  99. }
  100.